void main() {
  // dynamic 动态类型 什么类型都可以 就是any
  List goodsList = [
    {"id": 1, "price": 22.68, "count": 3, "goods_name": "西瓜", "selectd": true},
    {"id": 2, "price": 11.99, "count": 3, "goods_name": "草莓", "selectd": true},
    {
      "id": 3,
      "price": 60.99,
      "count": 1,
      "goods_name": "车厘子",
      "selectd": false
    },
    {
      "id": 4,
      "price": 11.68,
      "count": 3,
      "goods_name": "平谷大桃",
      "selectd": false
    }
  ];
  // 求商品的总价格
  List goodsArr =  goodsList.where((element) => element["selectd"] == true).toList();
  // 使用fold方法计算总价
  double TotalPrice =  double.parse(goodsArr.fold(0.0,(value,item)=>value+item['count'] * item['price']).toStringAsFixed(2));
  print(TotalPrice);
  
}